package com.web;
 
import org.java_websocket.enums.ReadyState;
 
import java.net.URISyntaxException;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws URISyntaxException, InterruptedException {
        MyWebSocketClient client = new MyWebSocketClient("ws://localhost:8081/websocket/server");
        client.connect();
        while (client.getReadyState() != ReadyState.OPEN) {
            System.out.println("连接状态：" + client.getReadyState());
            Thread.sleep(100);
        }
        Scanner sc = new Scanner(System.in);
        while (true){
            String s = sc.nextLine();
            client.send(s);
            if(s.equals("886"))
                break;
        }
        client.close();
    }
}